{	Problem: http://codeforces.ru/problemset/problem/110/A
	Verdict: Accepted
}
var
    i, x, ls : longint;
    s : string;

begin 
    readln(S);
    ls := length(s);
    x := 0;
    for i := 1 to ls do
        if s[i] in ['4', '7'] then inc(x);
    if (x = 4) or (x = 7) then write('YES') else write('NO');
end.